import {Component, OnInit} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {NbToastrService} from '@nebular/theme';
import {SERVER_URL} from '../../config';
import {NbToastStatus} from '@nebular/theme/components/toastr/model';

@Component({
  selector: 'app-question',
  templateUrl: './question.component.html',
  styleUrls: ['./question.component.css']
})
export class QuestionComponent implements OnInit {
  content: string;
  constructor(private http: HttpClient,
              private toastrService: NbToastrService) {
  }

  ngOnInit() {
  }
  submit() {
    const formData = new FormData();
    formData.append('content', this.content);
    this.http.post(SERVER_URL + '?s=App.Feedback.insert', formData).subscribe(data => {
      this.toastrService.show('感谢您的反馈', '提交成功', {status: NbToastStatus.SUCCESS});
    })
  }

}
